import React, { Component } from 'react';
import CustomBreadcrumb from '../../components/CustomBreadcrumb';
import ChannelTable from './components/ChannelTable';
import { ChannelService } from '../../services'

export default class Channel extends Component {
  static displayName = 'Channel';

  constructor(props) {
    super(props);
    this.state = {
      loading : true,
      channel : []
    };
  }

  componentDidMount = async() =>{
    let channel = await ChannelService.getChannel()
    this.setState({ channel, loading : false })
  }

  render() {
    const breadcrumb = [
      { text: '渠道管理', link: '' },
      { text: '渠道列表', link: '#/channel/list' },
    ];
    return (
      <div className="Channel-page">
        <CustomBreadcrumb dataSource={breadcrumb} />
        <ChannelTable loading={this.state.loading} channel={this.state.channel}/> 
      </div>
    );
  }
}
